package com.bw.zonghe0719.adapter

import android.graphics.Paint
import android.widget.TextView
import com.bw.base.entity.Goods
import com.bw.zonghe0719.R
import com.bw.zonghe0719.utils.GlideUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

class GoodsAdapter:BaseQuickAdapter<Goods,BaseViewHolder>(R.layout.item_goods) {
    override fun convert(holder: BaseViewHolder, item: Goods) {
        GlideUtils.loadCornerImage(context,item.image,holder.getView(R.id.goods_iv),10)
        holder.getView<TextView>(R.id.goods_name).text=item.storeName
        holder.setText(R.id.goods_price,"价格:￥${item.price}")
        holder.setText(R.id.goods_otPrice,"原价:￥${item.otPrice}")
        holder.setText(R.id.goods_sale,"已售:${item.sales+item.ficti}")//后台显示销量为 sales+ficti
        //原价删除线
        var otPrice = holder.getView<TextView>(R.id.goods_otPrice)
        otPrice.paintFlags=Paint.STRIKE_THRU_TEXT_FLAG//中划线(删除线)
    }
}